﻿@model int

@(Html.Kendo().Grid<OJS.Web.Areas.Administration.ViewModels.ProblemResource.ProblemResourceGridViewModel>()
    .Name("submissions-grid")
    .Columns(columns =>
    {
        columns.Bound(model => model.Id);
        columns.Bound(model => model.Name);
        columns.Bound(model => model.Type).ClientTemplate("#= TypeName #");
        columns.Bound(model => model.OrderBy);
        columns.Bound(model => model.Link).ClientTemplate("# if(Type == 3) { # <a href='#= Link #' class='btn btn-sm btn-primary' target='_blank'>Видео</a> # } else { # <a href='/Administration/Resources/Download/#= Id #' class='btn btn-sm btn-primary' >Свали</a> # } #");
    })
        .Pageable(x => x.Refresh(true))
        .Sortable(x => x.Enabled(true).AllowUnsort(false))
        .Filterable(x => x.Enabled(true))
        .DataSource(datasource => datasource
            .Ajax()
            .ServerOperation(true)
            .Sort(sort => sort.Add(x => x.Id))
            .Read(read => read.Action("ReadResources", "Problems", new { id = Model }))
        ))